package com.tianji.remark.controller;


import com.tianji.remark.domain.dto.LikeRecordFormDTO;
import com.tianji.remark.service.ILikedRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;
import java.util.Set;

/**
 * <p>
 * 点赞记录表 前端控制器
 * </p>
 *
 * @author Ys
 * @since 2023-08-13
 */
@RestController
@RequestMapping("/likes")
@Api(tags = "点赞记录业务相关接口")
public class LikedRecordController {

    @Autowired
    private ILikedRecordService likedRecordService;

   @PostMapping
   @ApiOperation("点赞或者取消点赞")
   public void addLikeRecord(@Valid @RequestBody LikeRecordFormDTO recordFormDTO){
       likedRecordService.addLikeRecord(recordFormDTO);
   }

    @GetMapping("/list")
    @ApiOperation("批量查询我的点赞状态")
    public Set<Long> getLikedIds(@RequestParam("bizIds") List<Long> bizIds){
       return likedRecordService.getLikedIds(bizIds);
    }

}
